import os

from flask_restful import Resource

from src.utils.config import config


# 健康检查文件路径
HEALTH_DIR = config.get_config('project', 'health_dir')
# 健康检查文件名
HEALTH_FILE = config.get_config('project', 'health_file')
HEALTH_PATH = os.path.join(HEALTH_DIR, HEALTH_FILE)


class PriceHealthAPI(Resource):
    """
    接口健康检查
    """
    def get(self):
        if os.path.exists(HEALTH_PATH):
            return {'code': 200}, 200
        return {'code': 400}, 400
